<div class="grid_9">

<?php if($this->session->flashdata('type')): ?>
	<div class="<?php echo $this->session->flashdata('type')?>"><?php echo $this->session->flashdata('msg')?></div>
<?php endif; ?>

<div class="inner-border">
<h6><?=$heading;?></h6>

<?php	
		if($mode == 'add'){
			$sy_from 	= $this->session->flashdata('sy_from')  !== false ? $this->session->flashdata('sy_from') : NULL;
			$sy_now 	= $this->session->flashdata('sy_now')   !== false ? $this->session->flashdata('sy_now') 	: NULL;
			$sy_title 	= $this->session->flashdata('sy_title') !== false ? $this->session->flashdata('sy_title'): NULL;
			$sy_desc 	= $this->session->flashdata('sy_desc')  !== false ? $this->session->flashdata('sy_desc') : NULL;
			$sy_id 		= $this->session->flashdata('sy)id')    !== false ? $this->session->flashdata('sy_id') 	: NULL;
			
		}elseif($mode == 'update'){
			if(!empty($sy_data)){
				foreach($sy_data as $entry){
						$year = explode('-' , $entry->sy_year);
						$sy_title = $entry->sy_title;
						$sy_desc  = $entry->sy_desc;
						$sy_id	  = $entry->sy_id;
				}
				$sy_from = $year[0];
				$sy_now	 = $year[1];
			}else{
				$sy_from 	= $this->session->flashdata('syfrom')  !== false ? $this->session->flashdata('sy_from') : NULL;
				$sy_now 	= $this->session->flashdata('synow')   !== false ? $this->session->flashdata('sy_now') 	: NULL;
				$sy_title 	= $this->session->flashdata('sy_title') !== false ? $this->session->flashdata('sy_title'): NULL;
				$sy_desc 	= $this->session->flashdata('sy_desc')  !== false ? $this->session->flashdata('sy_desc') : NULL;
				$sy_id 		= $this->session->flashdata('sy_id')    !== false ? $this->session->flashdata('sy_id') 	: NULL;
			}
		}

		$formAttrib = array('id' => 'schoolsetting', 'class' => 'admin-form');
		$sy_hiddenAttr  = array('sy_id' => $sy_id);
		$checkboxAttr  	= array('name' => 'current','value'=> 'true');
		$sy_fromAttr 	= array('name' => 'syfrom',		'value' => $sy_from,	'id' => 'syfrom','placeholder'=> 'year','maxlength'=>'5','style'=>'width:100px');
		$sy_nowAttr		= array('name' => 'synow',		'value' => $sy_now,		'id' => 'synow', 'placeholder'=> 'year','maxlength'=>'5','style'=>'width:100px');
		$sy_titleAttr	= array('name' => 'sy_title',	'value' => $sy_title,	'id' => 'synow');
		$sy_descAttr	= array('name' => 'sy_desc',	'value' => $sy_desc,	'id' => 'synow');

	?>
    <?php echo form_open('post/'.$mode.'_schoolyear', $formAttrib); ?>
    
	<div class="input-block">
    <?php
		echo form_label('School Year Title: ', 'schoolname');
		echo form_input($sy_titleAttr);
	?>
    </div>
    
    <div class="input-block">
    <?php
		echo form_label('School Year: ', 'schooladdress');
	    echo form_input($sy_fromAttr);
		echo ' -  ';
	    echo form_input($sy_nowAttr);
	?>
    </div>
    
    <div class="input-block">
    <?php
		echo form_label('Description: ', 'schooltelephone');
		echo form_textarea($sy_descAttr);
		echo form_hidden($sy_hiddenAttr);
	?>
    </div>
	
	<?if($mode == 'add'):?>
	<div class="input-block">
    <?php
		echo form_label('Set as Current SY?: ', 'schoolyear');
		echo form_checkbox($checkboxAttr);
	?>
    </div>
	<?endif;?>
    
    
    <div class="input-block">
		<input type="submit" value="<?=$mode;?>"><a href="<?php echo site_url('admin/school_year') ?>" class="btn">Cancel <?=$mode;?></a>
    </div>
	
	
		

</div>
</div>